<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //将数组['关羽', '张飞', '程咬金', '吕布']的内容反过来存放
        //  即 ['吕布', '程咬金', '张飞', '关羽']
        let arr =['关羽', '张飞', '程咬金', '吕布'];
        let arr1 =[];
        let arr2 =[];
            /* 
            index0   index1
               0        3
               1        2
               2        1
               3        0
              index0 + index1 = 3(arr.length -1)
              index1 = (arr.length - 1) - index0
        */
       for (let index in arr ){
        //console.log (index ,arr [index]);
        arr1[(arr.length-1) - index] =arr[index];

       }
       console.log(arr1);
       console.log('==============方案2------------');
       //倒叙遍历数组，再把元素放入新数组。
       for (let i=arr.length-1;i>=0;i--){
        //倒序遍历
        // console.log(i,arr[i]);
        arr2[arr2.length] =arr[i];

       }
       console.log(arr2);
    </script>
</body>
</html>